package org.mtree.context;

import org.mtree.context.wrapper.MapContextWrapper;
import org.mtree.context.wrapper.PropertiesContextWrapper;

/**
 * 上下文工具
 * 
 * @author rushman
 * @date 2017-11-04
 */
public class ContextHelper {

    public static final Context DEFAULT_CONTEXT = new CommonContext();

    public static Context getRootContext() {
        return getEnvContext();
    }

    public static Context getDefaultContext() {
        return DEFAULT_CONTEXT;
    }

    public static Context getEnvContext() {
        return new MapContextWrapper(System.getenv());
    }

    public static Context getSystemPropContext() {
        return new PropertiesContextWrapper(System.getProperties());
    }

}
